*cd "C:\Users\eyurdagu\Dropbox\minW_insurance\codes\outputs\store\BM_FINAL"

use "pol.dta", clear
gen model="bm"

append using "..\BM_nominw_FINAL\pol.dta"
replace model="nominw" if model==""

append using "..\BM_sgepsrecal_FINAL\pol.dta"
replace model="bm_sgepscalib" if model==""

append using "..\BM_rho90_FINAL\pol.dta"
replace model="rho90" if model==""

append using "..\BM_CD_withinocc_FINAL\pol.dta"

replace model="bm_2occ" if model==""


gen occ=1 if ix<=7
replace occ=2 if ix>7


*gen bite=0
*replace bite=1 if abs((log(wage)-log(minw))/log(minw))<0.0001


gen bite=1 if (wage-minw)/minw<0.1
replace bite=0 if (wage-minw)/minw>=0.1

gen bitefirmbin=.
forvalues ii=0(0.1)0.8 {
replace bitefirmbin=`ii' if bitefirmbin==. & bitefirm<`ii'+0.0001
}

replace bitefirmbin=1 if bitefirm>0.80001


/////////


egen gpid=group(ix itau ia model)
tsset gpid iz

gen chlogwage=log(L1.wage)-log(wage)


gen wageelastz=(log(L1.wage)-log(wage))/(log(L1.z)-log(z))
gen wageelastposz=(log(F1.wage)-log(wage))/(log(F1.z)-log(z))

gen wageelastzbig=(log(L2.wage)-log(wage))/(log(L2.z)-log(z))
gen wageelastzbigger=(log(L3.wage)-log(wage))/(log(L3.z)-log(z))

gen wageelastposzbig=(log(F2.wage)-log(wage))/(log(F2.z)-log(z))
gen wageelastposzbigger=(log(F3.wage)-log(wage))/(log(F3.z)-log(z))

gen unempelastz=-(L1.unemp-unemp)/(log(L1.z)-log(z))

gen unempelastposz=-(F1.unemp-unemp)/(log(F1.z)-log(z))


gen unempelastzbig=-(L2.unemp-unemp)/(log(L2.z)-log(z))
gen unempelastzbigger=-(L3.unemp-unemp)/(log(L3.z)-log(z))

/*
gen wageelastzrel=.
forvalues i=1/14 {
forvalues j=1/21 {
sum wageelastz if ix==`i' & iz==`j' & model=="nominw"
replace wageelastzrel=wageelastz-r(mean) if ix==`i' & iz==`j' & model=="bm"

sum wageelastz if ix==`i' & iz==`j' & model=="rho1_nominw"
replace wageelastzrel=wageelastz-r(mean) if ix==`i' & iz==`j' & model=="rho1"

}
}*/


/*
gen logwagechbm=.
forvalues i=1/14 {
forvalues j=1/21 {
sum logwage if ix==`i' & iz==`j' & model=="bm"
replace logwagechbm=logwage-r(mean) if ix==`i' & iz==`j'
}
}*/

/*
gen unempgraph=.
forvalues h=1/14 {
forvalues j=1/21 {
sum unemp if iz==`j' & ix==`h'
replace unempgraph=1 if r(max)>0.001 & iz==`j' & ix==`h'
}
}*/



*drop bitefirm
*rename bitefirmbin bitefirm

keep if bitefirm<=0.8

gen wagerel=log(wage)-log(minw)

/*
twoway (lpoly wageelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" , ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm.pdf", as(pdf) replace

twoway (lpoly wageelastposz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastposz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Wage elasticity to firm TFP", size(large)) yscale(range(0 1.5)) ylabel(0(0.5)1.5, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastpos_bitefirm.pdf", as(pdf) replace

twoway (lpoly unempelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" , ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelast_bitefirm.pdf", as(pdf) replace

twoway (lpoly unempelastposz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastposz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Unemp. elasticity to firm TFP", size(large)) yscale(range(0 1.5)) ylabel(0(0.5)1.5, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastpos_bitefirm.pdf", as(pdf) replace
*/

///////////////// By occ ////////


forvalues i=1/2 {

twoway (lpoly wageelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_occ`i'.pdf", as(pdf) replace

/*
twoway (lpoly wageelastposz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastposz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastpos_bitefirm_occ`i'.pdf", as(pdf) replace
*/

twoway (lpoly unempelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm"  & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelast_bitefirm_occ`i'.pdf", as(pdf) replace

/*
twoway (lpoly unempelastposz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastposz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastpos_bitefirm_occ`i'.pdf", as(pdf) replace
*/
/*

twoway (lpoly wageelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="rho90" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_rho90_occ`i'.pdf", as(pdf) replace

twoway (lpoly unempelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="rho90"  & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelast_bitefirm_rho90_occ`i'.pdf", as(pdf) replace
*/

//// MODEL RECALIBRATING SIGMA_EPSILON TO MATCH THE WAGE SD ////
twoway (lpoly wageelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm_sgepscalib" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_sgepscalib_occ`i'.pdf", as(pdf) replace

twoway (lpoly unempelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm_sgepscalib"  & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelast_bitefirm_sgepscalib_occ`i'.pdf", as(pdf) replace


//// MODEL WITH SEPARATE COMPLEMENTARITIES WITHIN OCCUPATION ////
twoway (lpoly wageelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm_2occ" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_occ`i'_2occ.pdf", as(pdf) replace

twoway (lpoly unempelastz bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastz bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm_2occ"  & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelast_bitefirm_occ`i'_2occ.pdf", as(pdf) replace




}


forvalues i=1/2 {





}

////////////


/*
twoway (lpoly wageelastzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIG_bitefirm.pdf", as(pdf) replace

twoway (lpoly wageelastposzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastposzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIG_bitefirm.pdf", as(pdf) replace


twoway (lpoly wageelastzbigger bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastzbigger bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIGGER_bitefirm.pdf", as(pdf) replace

twoway (lpoly unempelastzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastBIG_bitefirm.pdf", as(pdf) replace

twoway (lpoly unempelastzbigger bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastzbigger bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm", ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastBIGGER_bitefirm.pdf", as(pdf) replace
*/

/*
twoway (lpoly wageelastz bitefirm if model=="bm" [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if model=="rho1" [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort)  if bite==0, ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "No skill complementarities") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_acrossrho.pdf", as(pdf) replace
*/
//////////////////////// BIG BIGGER OCC SPECIFIC ///////////////////////////////


forvalues i=1/2 {
/*
twoway (lpoly wageelastzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIG_bitefirm_occ`i'.pdf", as(pdf) replace

twoway (lpoly wageelastposzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastposzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" &  occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIG_bitefirm_occ`i'.pdf", as(pdf) replace


twoway (lpoly wageelastzbigger bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastzbigger bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" &  occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelastBIGGER_bitefirm_occ`i'.pdf", as(pdf) replace

twoway (lpoly unempelastzbig bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastzbig bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" &  occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastBIG_bitefirm_occ`i'.pdf", as(pdf) replace

twoway (lpoly unempelastzbigger bitefirm if bite==1 [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly unempelastzbigger bitefirm if bite==0 [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort) if  model=="bm" & occ==`i', ///
ytitle("Unemp. elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Low-cushion workers" 2  "High-cushion workers") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_uelastBIGGER_bitefirm_occ`i'.pdf", as(pdf) replace
*/

/*
twoway (lpoly wageelastz bitefirm if model=="bm" [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if model=="rho1" [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort)  if bite==0  & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "No skill complementarities") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_acrossrho_occ`i'.pdf", as(pdf) replace
*/

/*
twoway (lpoly wageelastz bitefirm if model=="bm" [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if model=="rho60" [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort)  if bite==0  & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "Less skill complementarity") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_acrossrho60_occ`i'.pdf", as(pdf) replace
*/

twoway (lpoly wageelastz bitefirm if model=="bm" [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if model=="rho90" [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort)  if bite==0  & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "Less skill complementarity") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_acrossrho90_occ`i'.pdf", as(pdf) replace

/*
twoway (lpoly wageelastz bitefirm if model=="bm" [aw=distw], n(10) lcolor(blue) sort) ///
(lpoly wageelastz bitefirm if model=="rho90" [aw=distw], n(10) lcolor(red) lpattern(shortdash) sort)  if bite==1  & occ==`i', ///
ytitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) xtitle("Minimum wage bite", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "Less skill complementarity") rows(1) region(lcolor(white))) 
graph export "comparefigs/lpol_wageelast_bitefirm_acrossrho90_lowcushion_occ`i'.pdf", as(pdf) replace
*/

}

////// K densities //////
/*
forvalues i=1/2 {
twoway (kdensity wageelastz if model=="bm" [aw=distw], n(10) bwidth(0.1) lcolor(blue) sort) ///
(kdensity wageelastz if model=="rho1" [aw=distw], n(10) bwidth(0.1) lcolor(red) lpattern(shortdash) sort)  if bite==0 &  occ==`i' & wageelastz>0, ///
xtitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) ytitle("Density", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "No skill complementarities") rows(1) region(lcolor(white))) 
graph export "comparefigs/kdenswageelast_x_acrossrho_occ`i'.pdf", as(pdf) replace

twoway (kdensity wageelastz if model=="bm" [aw=distw], n(10) bwidth(0.1) lcolor(blue) sort) ///
(kdensity wageelastz if model=="rho60" [aw=distw], n(10) bwidth(0.1) lcolor(red) lpattern(shortdash) sort)  if bite==0 &  occ==`i' & wageelastz>0, ///
xtitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) ytitle("Density", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "Less skill complementarity") rows(1) region(lcolor(white))) 
graph export "comparefigs/kdenswageelast_x_acrossrho60_occ`i'.pdf", as(pdf) replace

twoway (kdensity wageelastz if model=="bm" [aw=distw], n(10) bwidth(0.1) lcolor(blue) sort) ///
(kdensity wageelastz if model=="rho90" [aw=distw], n(10) bwidth(0.1) lcolor(red) lpattern(shortdash) sort)  if bite==0 &  occ==`i' & wageelastz>0, ///
xtitle("Wage elasticity to firm TFP", size(large)) ylabel(, nogrid) ytitle("Density", size(large)) ///
graphregion(fcolor(white) lcolor(white)) plotregion(margin(large))  ///
legend(order(1 "Baseline" 2  "Less skill complementarity") rows(1) region(lcolor(white))) 
graph export "comparefigs/kdenswageelast_x_acrossrho90_occ`i'.pdf", as(pdf) replace

}*/